package com.atgion.manager.controller;


import com.atgion.manager.service.SysOperationLogService;
import com.atgion.spzx.model.entity.system.SysOperationLog;
import com.atgion.spzx.model.vo.base.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequiredArgsConstructor
@Tag(name = "SysOperationLogController", description = "日志信息控制层")
@RequestMapping("/sys/log")
public class SysOperationLogController {

    final SysOperationLogService sysOperationLogService;

    @Operation(summary = "导出数据")
    @PostMapping(value = "/getExportList")
    public Result<List<SysOperationLog>> add(@RequestBody SysOperationLog sysOperationLog) {
        return Result.success(sysOperationLogService.getExportList(sysOperationLog));
    }

        //  日志分页信息
        @Operation(summary = "list 分页列表")
        @Parameters({@Parameter(name = "current", description = "当前页", required = true, example = "1"),
                     @Parameter(name = "size", description = "每页显示条数", required = true, example = "10"),
                     @Parameter(name = "createBy", description = "创建名"),})
        @GetMapping(value = "/getRoleList")
        public Result<IPage<SysOperationLog>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
            return Result.success(sysOperationLogService.getPage(params));
        }



}
